<template>
	<view class="content">
		<view class="section-0">
			<view class="section-body">
				<view v-show="question != 1" class="frequency">{{user_name}}发现的问题</view>
				<view v-show="question == 1" class="frequency">{{project_name}}</view>
			</view>
		</view>
		<view class="section-1">
			<view class="list">
				<problemItem v-for="(item, idx) in list" :item="{...item, code: idx + 1}"></problemItem>
				<!-- <view class="item" v-for="item in list">
					<view class="project">{{item.project_name}}</view>
					<view class="img">
						<image mode="aspectFill" src="../../../../../../src/imgs/test.jpg"></image>
						<view class="title">{{item.check_content}}</view>
					</view>
					<view class="info">
						<view class="info-item">
							<view class="label">类型</view>
							<view class="value">{{item.check_type == 1 ? '质量问题' : '安全问题'}}</view>
						</view>
						<view class="info-item">
							<view class="label">违章库</view>
							<view class="value">{{item.peccancy_type}}</view>
						</view>
						<view class="info-item">
							<view class="label">责任人</view>
							<view class="value">{{item.zrr_name}}</view>
						</view>
						<view class="info-item">
							<view class="label">罚款</view>
							<view class="value">{{item.fk_money}}</view>
						</view>
					</view>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	import  problemItem from '@/components/problem_item/index.vue';
	import { performProblemDetailApi, problemDetailApi} from '@/api/statistics.js';
	import { mapGetters, mapActions} from 'vuex';
	export default {
		components: { problemItem },
		data() {
			return {
				name: '',
				list: [],
				user_name: '',
				time_type: '',
				id:'',
				question:'',
				project_name:''
			};
		},
		methods:{
			
			async fetchData() {
				uni.showLoading({title: '加载中...'});
				const { data } = await performProblemDetailApi(
					{
						user_name: this.user_name,
						time_type: this.time_type,
						pageSize:'99999999'
					}
				);
				uni.hideLoading();
				if (data.code === 1) {
					this.list = data.data.data;
					
				} 
			},
			async problemDetailApi() {
				uni.showLoading({title: '加载中...'});
				const { data } = await problemDetailApi(
					{
						project_id: this.id,
						pageSize:'99999999'
					}
				);
				uni.hideLoading();
				if (data.code === 1) {
					this.list = data.data.data;
					
				} 
			}
		},
		onReady() {
			if(this.question ==1){
				this.problemDetailApi()
			}else{
				this.fetchData();
			}
		},
		onLoad(data) {
			this.question = data.question
			if(this.question == 1){
				uni.setNavigationBarTitle({
					title: '问题列表'
				});
				this.id = data.id
				this.project_name = data.project_name
			}else{
				uni.setNavigationBarTitle({
					title: '全部发现问题'
				});
				this.user_name = JSON.parse(data.params)['user_name'];
				this.time_type = JSON.parse(data.params)['time_type'];
			}
			
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		background-color: #fff;
	}
	.section-1{
		position: relative;
		top: -50rpx;
		z-index: 10;
		background-color: #fff;
		border-top-left-radius: 50rpx;
		border-top-right-radius: 50rpx;
		box-sizing: border-box;
		padding-top: 30rpx;
		width: 100%;
		padding-bottom: 30rpx;
		// .listss{
		// 	width: 100%;
		// 	.item{
		// 		padding: 0 75rpx;
		// 		box-sizing: border-box;
		// 		border-bottom: solid 2rpx #e2e7f5;

		// 	}
		// 	.project{
		// 		font-size: 26rpx;
		// 		font-weight: normal;
		// 		font-stretch: normal;
		// 		line-height: 36rpx;
		// 		letter-spacing: 0rpx;
		// 		color: #000000;
		// 		margin-top: 20rpx;
		// 		margin-bottom: 10rpx;
		// 	}
		// 	.img{
		// 		width: 100%;
		// 		height: 248rpx;
		// 		background-color: #000000;
		// 		border-radius: 35rpx;
		// 		position: relative;
		// 		overflow: hidden;
		// 		image{
		// 			width: 100%;
		// 			height: 100%;
		// 		}
		// 		.title{
		// 			position: absolute;
		// 			left: 0;
		// 			bottom: 0;
		// 			width: 100%;
		// 			height: 65rpx;
		// 			background-color: rgba(0, 0, 0, 0.7);
		// 			text-align: center;
		// 			line-height: 65rpx;
		// 			font-size: 26rpx;
		// 			font-weight: normal;
		// 			font-stretch: normal;
		// 			letter-spacing: 3rpx;
		// 			color: #ffffff;
		// 		}
		// 	}
		// 	.info{
		// 		margin-top: 15rpx;
		// 		margin-bottom: 30rpx;
		// 		@include clear();
		// 		.info-item{
		// 			float: left;
		// 			width: 25%;
		// 			.label{
		// 				height: 30rpx;
		// 				font-family: SourceHanSansCN-Regular;
		// 				font-size: 16rpx;
		// 				font-weight: normal;
		// 				font-stretch: normal;
		// 				line-height: 30rpx;
		// 				letter-spacing: 0rpx;
		// 				color: #8497ac;
		// 				margin-bottom: 3rpx;
		// 			}
		// 			.content{
						
		// 				font-size: 26rpx;
		// 				font-weight: bold;
		// 				font-stretch: normal;
		// 				line-height: 34rpx;
		// 				letter-spacing: 0rpx;
		// 				color: #46464a;
		// 			}
		// 		}
		// 	}
		// }
	}
	.section-0{
		width: 100%;
		background-color: #2e5efe;
		.section-body{
			width: 100%;
			padding-left: 75rpx;
			height: 150rpx;
			padding-right: 40rpx;
			padding-bottom: 50rpx;
			background-color: #1534ce;
			background-size: cover;
			background-repeat: no-repeat;
			border-top-left-radius: 50rpx;
			border-top-right-radius: 50rpx;
			overflow: hidden;
			box-sizing: border-box;
			.frequency{
				width: 100%;
				height: 100rpx;
				line-height: 100rpx;
				font-size: 26rpx;
				color: #87c6ff;
				span{
					color: #fff;
				}
			}
		}
	}
</style>

